package com.hangwei.paperless.presenter;

import android.support.v4.widget.SwipeRefreshLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hangwei.paperless.model.bean.PNBean;
import com.hangwei.paperless.net.NetManager;
import com.twelve.all.net.ResponseInfo;
import com.twelve.all.utils.SPKey;
import com.twelve.all.utils.SPUtil;

import java.util.List;

import rx.Observable;

/**
 * Created by 张龙臣 on 2020/12/9.
 */

public class PNPresenter extends RecyclerPresenter<PNBean> {

    private final String mUserId;
    private final boolean isFuzzyMatch = true;
    private String mPn;

    public PNPresenter(SwipeRefreshLayout refreshLayout, BaseQuickAdapter<PNBean, BaseViewHolder> adapter) {
        super(refreshLayout, adapter);
        mUserId = SPUtil.getString(SPKey.Account.USER_ID);
    }

    @Override
    protected Observable<ResponseInfo<List<PNBean>>> getObservable(int page) {
        return NetManager.getResponseInfoAPI().getPartnoList(mUserId,mPn,isFuzzyMatch,PAGE_SIZE,page);
    }

    public void setPn(String pn) {
        mPn = pn;
    }
}
